package com.xuecheng.content.controller;

import com.xuecheng.commons.model.dto.TeachplanDto;
import com.xuecheng.commons.model.vo.ResponseResult;
import com.xuecheng.commons.model.vo.TeachplanVo;
import org.springframework.web.bind.annotation.*;
import com.xuecheng.content.service.TeachplanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 * 课程计划前端控制器
 * </p>
 *
 * @author itheima
 */
@Slf4j
@RestController
@RequestMapping("/teachplan")
public class TeachplanController {

    @Autowired
    private TeachplanService  teachplanService;
    @GetMapping("/{courseId}/tree-nodes")
    public ResponseResult treeNodes(@PathVariable("courseId")Long courseId){
return teachplanService.treeNodes(courseId);
    }

    //保存课程计划或者更新
    @PostMapping
    public ResponseResult saveOrUpdate(@RequestBody TeachplanDto dto){
        return teachplanService.saveOrUpdatePlan(dto);
    }

}
